package com.purplesoft.zettl.DatabaseViews;

import android.provider.BaseColumns;

import com.purplesoft.zettl.DatabaseTables.TblCart;
import com.purplesoft.zettl.DatabaseTables.TblCategories;
import com.purplesoft.zettl.DatabaseTables.TblItems;
import com.purplesoft.zettl.DatabaseTables.TblLists;
import com.purplesoft.zettl.DatabaseTables.TblManufacturer;
import com.purplesoft.zettl.DatabaseTables.TblMeasures;

public class VwCartItems {

	public class Columns implements BaseColumns {

		// columns of table "tbl_Items"
		public static final String _ID = "_ID";
		public static final String ItemID = "ItemID";
		public static final String Item = "Item";
		public static final String Amount = "Amount";
		public static final String ListID = "ListID";
		public static final String ListName = "ListName";
		public static final String ItemDescription = "Description";
		public static final String ItemImg = "ItemImg";
		public static final String ManufacturerID = "ManufacturerID";
		public static final String Manufacturer = "Manufacturer";
		public static final String MeasureID = "MeasureID";
		public static final String Measure = "Measure";
		public static final String MeasureShort = "MeasureShort";
		public static final String Min = "Min";
		public static final String Max = "Max";
		public static final String IncreaseBy = "IncreaseBy";
		public static final String PricePer = "PricePer";
		public static final String Price = "Price";
		public static final String CategoryID = "CategoryID";
		public static final String CategoryName = "CategoryName";
		public static final String CategoryColor = "CategoryColor";
		public static final String CategorySymbol = "CategorySymbol";
		public static final String GroceryName = "GroceryName";
		public static final String GroceryAdress = "GroceryAdress";
		public static final String Notes = "Notes";

	}

	public static final String viewName = "vwCartItems";
	public static final String CONTENT_TYPE = "vnd.android.cursor.dir/com.purplesoft.zettl.vwCartItems";

	public static final String createView = "CREATE VIEW " + viewName
			+ " AS SELECT ca." + Columns._ID 
			+ ", ca." + Columns.ItemID
			+ ", i." + Columns.Item 
			+ ", ca." + Columns.Amount 
			+ ", ca." + Columns.ListID 
			+ ", l." + Columns.ListName 
			+ ", i." + Columns.ItemDescription 
			+ ", i." + Columns.ItemImg 
			+ ", i." + Columns.ManufacturerID 
			+ ", m." + Columns.Manufacturer 
			+ ", i." + Columns.MeasureID 
			+ ", me." + Columns.Measure
			+ ", me." + Columns.MeasureShort 
			+ ", me." + Columns.Min
			+ ", me." + Columns.Max
			+ ", me." + Columns.IncreaseBy
			+ ", me." + Columns.PricePer
			+ ", i." + Columns.Price 
			+ ", i." + Columns.CategoryID 
			+ ", c." + Columns.CategoryName 
			+ ", c." + Columns.CategoryColor 
			+ ", c." + Columns.CategorySymbol 
			+ ", i." + Columns.Notes 
			+ " FROM " 
			+ TblCart.tableName + " ca, "
			+ TblItems.tableName + " i, " 
			+ TblMeasures.tableName + " me, "
			+ TblCategories.tableName + " c, " 
			+ TblLists.tableName  + " l, "
			+ TblManufacturer.tableName + " m WHERE ca."
			+ TblCart.Columns.ItemID + " = i." + TblItems.Columns._ID
			+ " and i." + TblItems.Columns.ManufacturerID + " = m." + TblManufacturer.Columns._ID 
			+ " and i." + TblItems.Columns.MeasureID + " = me." + TblMeasures.Columns._ID
			+ " and i." + TblItems.Columns.CategoryID + " = c." + TblCategories.Columns._ID
			+ " and ca." + TblCart.Columns.ListID + " = l." + TblLists.Columns._ID;

}
